home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac: Not for Sale / Another.not.for.sale (Australia).iso / fade into you / getting there / WWW / WebStat 2.3.4 / WebStat.h < prev    next >
Text File  |  1994-10-03  |  1KB  |  67 lines

  1. /*
  2. **    File:        WebStat.h
  3. **
  4. **    Author:        P. Harvey
  5. **
  6. **    Comments:    Class definitions for WebStat program
  7. */
  8.  
  9. #include <stdio.h>
  10. #include <time.h>
  11.  
  12. class Statistic {
  13. public:
  14.     Statistic();
  15.     ~Statistic();
  16.     
  17.     void    IncrStats(double byte_count);
  18.  
  19.     unsigned long    files;
  20.     double            bytes;
  21.     char *            name;
  22. };
  23.  
  24. extern "C" typedef int (*CompFunc)(const void *, const void *);
  25.  
  26. class StatList {
  27. public:
  28.     StatList(long iSize);
  29.     ~StatList();
  30.     
  31.     void            Write(FILE *fp, char *heading);
  32.     void            IncrStats(double byte_count, char *str);
  33.     long            SearchStat(char *str);
  34.     void            Substitute(char *(*func)(const char *));
  35.     void            Sort(CompFunc func=0);
  36.     static void        Summarize(FILE *fp, time_t first, time_t last);
  37.     static void        IncrTotals(double byte_count);
  38.     
  39. private:
  40.     Statistic        *stat;        // pointer to statistics table
  41.     long            num;        // number of entries in table
  42.     long            maxNum;        // number of entries allocated
  43.     long            incrSize;    // number of entries to expand by
  44.     
  45.     static unsigned long    totalFiles;
  46.     static double            totalBytes;
  47. };
  48.  
  49. class StringLookup {
  50. public:
  51.     StringLookup(long incr,Boolean part);
  52.     ~StringLookup();
  53.     
  54.     void            Add(char *code, char *name);
  55.     char *            Lookup(char *code);
  56.     
  57. private:
  58.     long        num;
  59.     long        maxNum;
  60.     long        incrNum;
  61.     char        **list;            // Format is "<code>\0<name>\0"
  62.     Boolean        partialCompare;
  63. };
  64.     
  65. extern "C" int CompStat(const void *p1, const void *p2);
  66. extern "C" int CompStatNum(const void *p1, const void *p2);
  67.